package com.xquant.trade.trade.service;


import cn.hutool.core.util.NumberUtil;
import com.xquant.trade.trade.entity.TradeDetileDto;
import com.xquant.trade.trade.mapper.TradeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.File;
import java.util.Map;

/**
 * @Author: xpp -_- -_-
 * @Date: 2021/8/4 14:09
 */
@Component
public abstract class RenderExporter {

    @Autowired
    protected TradeMapper tradeMapper;
    //模板文件
    protected File TemporaryFile = null;

    public  File getTemporaryFile() {
        return TemporaryFile;
    }

    public  void setTemporaryFile(File temporaryFile) {
        TemporaryFile = temporaryFile;
    }


    //渲染数据
    public abstract Map RenderData(TradeDetileDto tradeDetile) ;
    public abstract TradeDetileDto getTradeDetile(Map params);

    public static   String percentString(Object number){
        double d = Double.parseDouble(number.toString());
        return NumberUtil.decimalFormat("##.####%", d);
    }

}
